#include <iostream>
#include <unistd.h>
#include <signal.h>
using namespace std;

void sigcb(int signo)
{
    cout << "处理信号signo: " << signo << endl;
    exit(1);
}

int main()
{
    // signal(SIGINT, sigcb);

    // struct sigaction act, oldact;
    // act.sa_handler = sigcb;
    // act.sa_flags = 0;
    // sigaction(SIGINT, &act, &oldact);

    sigset_t set;
    sigemptyset(&set);
    sigaddset(&set, 2);
    sigaddset(&set, 40);
    sigprocmask(SIG_BLOCK, &set, nullptr);

    int cnt = 5;
    while (cnt--)
    {
        cout << "向当前进程发送2号、40号信号" << endl;
        raise(2);
        raise(40);
        sleep(1);
    }

    return 0;
}